// typeof
// 当typeof作用于类的时候，得到的类型，是该类的构造函数
/* const a: string = "abcd";
const b: typeof a = "abcdaa";

class User {
  loginId: string;
  loginPwd: string;
}

// function createUser(cls: typeof User): User {
function createUser(cls: new () => User): User {
  return new cls();
}

const u = createUser(User); */

// keyof: 作用与类，接口，类型别名，用于获取其他类型中的所有成员组合的联合类型
/* interface User {
  loginId: string;
  loginPwd: string;
  age: number;
}

function printUserProperty(obj: User, prop: keyof User) {
  console.log(obj[prop]);
} */

// in: 该关键字往往和keyof联用，限制某个索引类型的取值范围

interface User {
  loginId: string;
  loginPwd: string;
  age: number;
  createDate: Date;
}

type Partial1<T> = {
  readonly [p in keyof T]?: T[p];
};

type UserPartial = Partial1<User>;

type UserString = {
  [p in keyof User]: string;
};
const U: UserString = {
  loginId: "123",
  loginPwd: "zcsad",
  age: "123",
  createDate: "12-12-12",
};

export {};
